
import { Base } from '../utils/base.js';

class Team extends Base {
    constructor() {
        super();
    }

    // 获取当前员工状态
    checkTeamUser(data,callBack) {
        var params = {
            url: 'check/team',
            type: 'POST',
            data: data,
            sCallBack: function (res) {
                callBack && callBack(true, res);
            },
            eCallBack: function (res) {
                callBack && callBack(false, res);
            },
        }
        this.request(params);
    }

    // 创建员工信息
    createTeamUser(data, callBack) {
        var params = {
            url: 'team-user',
            type: 'POST',
            data: data,
            sCallBack: function (res) {
                callBack && callBack(true, res);
            },
            eCallBack: function (res) {
                callBack && callBack(false, res);
            },
        }
        this.request(params);
    }

    getTeamUserStaff(callBack){
        var params = {
            url: 'team-user/staff',
            type: 'GET',
            sCallBack: function (res) {
                callBack && callBack(res);
            },
        }
        this.request(params);
    }

    // 获取团信息
    getTeam(callBack) {
        var params = {
            url: 'team',
            type: 'GET',
            sCallBack: function (res) {
                callBack && callBack(res);
            }
        };
        this.request(params);
    }

    // 获取员工二维码信息
    getTeamUser(callBack) {
        var params = {
            url: 'team-user',
            type: 'GET',
            sCallBack: function (res) {
                callBack && callBack(res);
            }
        }
        this.request(params);
    }

    // 获取销售额信息
    getTeamUserRank(user_id,callBack) {
        var params = {
            url: 'team-user/rank?user_id='+user_id,
            type: 'GET',
            sCallBack: function (res) {
                callBack && callBack(res);
            }
        }
        this.request(params);
    }

    // 获取收入信息
    getTeamUserInviteRank(callBack) {
        var params = {
            url: 'team-user/invite-rank',
            type: 'GET',
            sCallBack: function (res) {
                callBack && callBack(res);
            }
        }
        this.request(params);
    }

    // 获取我的裂变信息
    getTeamUserRankByUser(callBack) {
        var params = {
            url: 'team-user/user-rank',
            type: 'GET',
            sCallBack: function (res) {
                callBack && callBack(res);
            }
        }
        this.request(params);
    }
}

export { Team };
